package org.linlinjava.litemall.admin.web;


import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.linlinjava.litemall.admin.annotation.RequiresPermissionsDesc;
import org.linlinjava.litemall.core.util.ResponseUtil;
import org.linlinjava.litemall.core.validator.Order;
import org.linlinjava.litemall.core.validator.Sort;
import org.linlinjava.litemall.db.domain.LitemallMoneyLog;
import org.linlinjava.litemall.db.domain.LitemallUser;
import org.linlinjava.litemall.db.service.LitemallMoneyLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/admin/moneyLog")
public class AdminMoneyLogController {

    @Autowired
    LitemallMoneyLogService litemallMoneyLogService;

    @RequiresPermissions("admin:news:list")
    @RequiresPermissionsDesc(menu = {"奖励日志", "日志列表"}, button = "列表")
   @GetMapping("/list")
    public Object list(@RequestParam(defaultValue = "1") Integer page,
                       @RequestParam(defaultValue = "10") Integer limit,
                       @RequestParam(defaultValue = "updatetime") String sort,
                       @RequestParam(defaultValue = "asc") String order,
                       @RequestParam(required = false,name = "start") String starttime,
                       @RequestParam(required = false,name = "end") String lasttime) {



       List<LitemallMoneyLog> litemallMoneyLogList = litemallMoneyLogService.querySelective(page, limit, sort, order,starttime,lasttime);
        return ResponseUtil.okList(litemallMoneyLogList);

    }


}
